package com.innovation.chengzhangriji.ui.widget;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

public class ThemeItemDecoration extends RecyclerView.ItemDecoration {

    private Paint paintLine;

    public ThemeItemDecoration() {
        paintLine = new Paint();
        paintLine.setColor(Color.rgb(244, 244, 246));
    }
    @Override
    public void getItemOffsets(Rect outRect, View view,
                               RecyclerView parent, RecyclerView.State state) {
        outRect.set(0, 0, (int) (15 * parent.getResources().getDisplayMetrics().density), 0);
        if(((RecyclerView.LayoutParams)view.getLayoutParams()).getViewLayoutPosition() == parent.getAdapter().getItemCount() - 1) {
            outRect.right = 0;
        }
    }
}
